from fastapi import Depends
# from loguru import logger
from models.projectDemo import Demo
from schemas.demoSchemas import DemoCreate, DemoResponse
from database.database import get_db
from sqlalchemy.orm import Session

from utils.log import custom_logger

class DemoClient:
    def __init__(self, db: Session = Depends(get_db)):
        self.db = db
        self.logger = custom_logger('xxx')
        self.logger.info("DemoClient initialized")
        

    def create_demo(self, demo: DemoCreate) -> DemoResponse:
        db_demo = Demo(**demo.dict())
        self.db.add(db_demo)
        self.db.commit()
        self.db.refresh(db_demo)
        return db_demo
    